package com.example.tests;

import org.junit.Before;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;


@Test
public class Chrome_test {
	private StringBuffer verificationErrors = new StringBuffer();
	WebDriver driver = null;
	@Before
  public void Chrome_test() throws Exception {
		
	  System.setProperty("webdriver.chrome.driver",
				"C://Tools//chromedriver.exe"); 
				driver = new ChromeDriver();
	  
  //  WebDriverUtils util = new WebDriverUtils(driver); 
    driver.get("http://www.google.com");
    driver.get("https://accounts.google.com/ServiceLogin?service=mail&continue=https://mail.google.com/mail/");
    driver.findElement(By.id("Email")).clear();
    driver.findElement(By.id("Email")).sendKeys("vitaliiTest12@gmail.com");
    driver.findElement(By.id("Passwd")).clear();
    driver.findElement(By.id("Passwd")).sendKeys("F6v32R3v");
    driver.findElement(By.id("signIn")).click();
    Thread.sleep(7000);
    driver.findElement(By.id("gbqfq")).clear();
    driver.findElement(By.id("gbqfq")).sendKeys("hello user!");
    driver.findElement(By.id("gbqfb")).click();
    Thread.sleep(7000);
 //   try {
  //      assertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*css=td\\.TC[\\s\\S]*$"));
  //    } catch (Error e) {
  //      verificationErrors.append(e.toString());
  //    }
  //  util.TakeScreenShot("Test1");
    driver.findElement(By.id("gbqfq")).click();
    driver.findElement(By.id("gbqfq")).clear();
    driver.findElement(By.id("gbqfq")).sendKeys("hi user!");
    driver.findElement(By.id("gbqfb")).click();
    Thread.sleep(7000);
  //  try {
   //     AssertTrue(driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*css=td\\.TC[\\s\\S]*$"));
   //   } catch (Error e) {
    //    verificationErrors.append(e.toString());
    //  }
   // util.TakeScreenShot("Test");
    driver.findElement(By.linkText("vitaliitest12@gmail.com")).click();
    driver.findElement(By.id("gb_71")).click();
    driver.quit();
  }

}
